package com.huawei.gamebox.service.common.cardkit.card;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.LineImageView;
import com.huawei.gamebox.service.common.cardkit.bean.BannerEntryCardBean;
import com.huawei.gamebox.service.common.cardkit.bean.MultiEntriesCardBean;
import java.util.Collections;
import java.util.List;
import o.azb;
import o.cgz;
import o.chy;
import o.Logger;
import o.dof;
import o.ContentManager;
import o.epv;
import o.eqx;
import o.eqz;
import o.exp$a;
import o.exp.d;

public abstract class BaseCloverEntryCardV2 extends BaseCloverEntryCard {
    protected LineImageView ʻ;
    protected TextView ʼ;
    protected TextView ʽ;
    protected View ˊ;
    protected TextView ˊॱ;
    protected TextView ˋ;
    protected LineImageView ˋॱ;
    protected LineImageView ˎ;
    protected View ˏॱ;
    protected TextView ͺ;
    protected View ॱ;
    private List<BannerEntryCardBean> ॱˊ;
    protected View ॱॱ;
    protected TextView ᐝ;

    static class a implements eqz {
        private a() {
        }

        public void ॱ(Bitmap bitmap) {
            if (Logger.ˎ()) {
                Logger.ˏ("BaseCloverEntryCardV2", "onImageLoaded");
            }
        }
    }

    protected abstract int ˊ();

    protected abstract void ˎ();

    public BaseCloverEntryCardV2(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        ˊ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        ˎ();
        if (cardBean instanceof MultiEntriesCardBean) {
            MultiEntriesCardBean multiEntriesCardBean = (MultiEntriesCardBean) cardBean;
            if (dof.ʽ(multiEntriesCardBean.v_())) {
                this.ʿ.setVisibility(4);
            } else {
                this.ʿ.setVisibility(0);
                this.ʿ.setText(multiEntriesCardBean.v_());
            }
            this.ॱˊ = ((MultiEntriesCardBean) cardBean).ˊ();
            if (this.ॱˊ != null && this.ॱˊ.size() > 0) {
                Collections.sort(this.ॱˊ);
                if (this.ॱˊ.size() >= 1) {
                    ˎ((BannerEntryCardBean) this.ॱˊ.get(0), this.ˊ, this.ˎ, this.ˋ, this.ʼ);
                }
                if (this.ॱˊ.size() >= 2) {
                    ˎ((BannerEntryCardBean) this.ॱˊ.get(1), this.ॱॱ, this.ʻ, this.ʽ, this.ᐝ);
                }
                if (this.ॱˊ.size() >= 3) {
                    ˎ((BannerEntryCardBean) this.ॱˊ.get(2), this.ˏॱ, this.ˋॱ, this.ͺ, this.ˊॱ);
                }
            }
        }
    }

    private void ˎ(BannerEntryCardBean bannerEntryCardBean, View view, LineImageView lineImageView, TextView textView, TextView textView2) {
        int dimensionPixelSize;
        int dimensionPixelSize2;
        view.setTag(bannerEntryCardBean);
        textView.setText(bannerEntryCardBean.ˊ());
        textView2.setText(bannerEntryCardBean.ᐝ());
        Context ˋ = ContentManager.getInstant().getContext();
        if (epv.ʼ(ˋ)) {
            if (bannerEntryCardBean.ॱ() == 1) {
                dimensionPixelSize = ˋ.getResources().getDimensionPixelSize(exp$a.ॱॱ);
                dimensionPixelSize2 = ˋ.getResources().getDimensionPixelSize(exp$a.ʼ);
            } else {
                dimensionPixelSize = ˋ.getResources().getDimensionPixelSize(exp$a.ॱˊ);
                dimensionPixelSize2 = ˋ.getResources().getDimensionPixelSize(exp$a.ˏॱ);
            }
            int i = dimensionPixelSize2;
            dimensionPixelSize2 = dimensionPixelSize;
            dimensionPixelSize = i;
        } else {
            dimensionPixelSize2 = ˋ.getResources().getDimensionPixelSize(exp$a.ˋॱ);
            dimensionPixelSize = ˋ.getResources().getDimensionPixelSize(exp$a.ͺ);
        }
        eqx.ˏ(dimensionPixelSize2, dimensionPixelSize, lineImageView, ॱ(bannerEntryCardBean), "image_default_icon", new a(), false);
    }

    protected String ॱ(BannerEntryCardBean bannerEntryCardBean) {
        if (epv.ʼ(this.ˏ)) {
            return bannerEntryCardBean.ॱˌ();
        }
        return bannerEntryCardBean.ˑॱ();
    }

    protected void ˊ(View view) {
        this.ʿ = (TextView) view.findViewById(d.ꜞ);
        azb.ˏ(view, d.ˏͺ);
        view.findViewById(d.ꜟ).setVisibility(4);
        View findViewById = view.findViewById(d.ˏͺ);
        findViewById.setPadding(0, findViewById.getPaddingTop(), findViewById.getPaddingRight(), findViewById.getPaddingBottom());
        this.ॱ = view.findViewById(d.ˈ);
        this.ˊ = view.findViewById(d.ॱ);
        this.ˎ = (LineImageView) view.findViewById(d.ʻ);
        this.ˋ = (TextView) view.findViewById(d.ʼ);
        this.ʼ = (TextView) view.findViewById(d.ʽ);
        this.ॱॱ = view.findViewById(d.ॱॱ);
        this.ʻ = (LineImageView) view.findViewById(d.ᐝ);
        this.ʽ = (TextView) view.findViewById(d.ˊॱ);
        this.ᐝ = (TextView) view.findViewById(d.ॱˊ);
        this.ˏॱ = view.findViewById(d.ͺ);
        this.ˋॱ = (LineImageView) view.findViewById(d.ˏॱ);
        this.ͺ = (TextView) view.findViewById(d.ʻॱ);
        this.ˊॱ = (TextView) view.findViewById(d.ˋॱ);
    }

    public void ॱ(chy o_chy) {
        OnClickListener ʽ = ʽ();
        this.ˊ.setOnClickListener(ʽ);
        this.ॱॱ.setOnClickListener(ʽ);
        this.ˏॱ.setOnClickListener(ʽ);
    }
}
